/**
 * Created by Administrator on 2016/12/29.
 */
/*
 * 引入http模块目的：就是为了去搭建一个web服务器. + express
 * */
var http = require("http");
var fs = require("fs");


var port = 3000;
var host = "127.0.0.1";
var root = __dirname;

http.createServer(function(req,res){
    res.writeHead(200,{"Content-Type":"text/html;charset=utf-8"});
    fs.readFile(root+"/index.html",function(err,data){
        if(err){
            throw  err;
        }
        res.end(data);
    });
}).listen(port,host);
console.log("当前服务器已经打开：端口是：3000");
